home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Gamer (Italian) 36
/
PC Gamer IT CD 36 2-2.iso
/
VIGDEMO
/
data1.cab
/
Assets
/
scripts
/
handgrenade.e
< prev
next >
Wrap
Text File
|
1998-09-21
|
6KB
|
766 lines
int Initialize(string type)
{
global int state;
global real explodeTime = 3.5;
global int hitValue = 20;
global real gEndTime = 0.0;
global real gSmokeTime = 0.20;
global int gSmokeTrail = 0;
global real gExplodeRadius = 30.0;
global int gBulletCount = 5;
global real gElasticity = .5;
global int gContrail = 0;
global int gPrivileged;
global int gStartSound = 7;
global int gProgressSound = 18;
global int gEndSound = 27;
global real gMass = 5.0;
Reset("dummy");
return 0;
}
int startsound(string soundname)
{
gStartSound = GetSoundIndex(soundname);
}
int endsound(string soundname)
{
gEndSound = GetSoundIndex(soundname);
}
int progresssound(string soundname)
{
gProgressSound = GetSoundIndex(soundname);
}
int contrail(string str)
{
gContrail = Str2Int(str);
}
int elas(string str)
{
gElasticity = Str2Real(str);
}
int Reset(string dummy)
{
state = 0;
SetElas(thisObject,0.0);
wakeupTime = -1.0;
SetCollidableProperties(thisObject,0,0);
SetStyle(thisObject,2);
gPrivileged = 0;
SetScale(thisObject,2.0);
return 0;
}
int SetBulletCount(int count)
{
gBulletCount = count;
}
int zombie(string hello)
{
SetCollidableProperties(thisObject,0,0);
SetStyle(thisObject,4);
SetScale(thisObject,1.0);
}
int exploderadius(string str)
{
gExplodeRadius = Str2Real(str);
}
int damage(string str)
{
hitValue = Str2Int(str);
return 0;
}
int ArmMe(string dummy)
{
real time ;
time = GetTime(thisObject);
if (state == 0)
{
state = 5;
SetElas(thisObject,gElasticity);
SetCollidableProperties(thisObject,1,1);
SetStyle(thisObject,4);
PlaySound(thisObject,gStartSound);
gPrivileged = 1;
SetOldPos(thisObject);
wakeupTime = time + 0.05;
gEndTime = time + explodeTime;
IgnoreCollision(thisObject);
}
return 0;
}
int ExplodeFulfill(int param)
{
real time ;
time = GetTime(thisObject);
state = 4;
KillEFX(thisObject,gSmokeTrail);
gSmokeTrail = 0;
LaunchEFX(thisObject,2,0);
Explode(thisObject,hitValue,gExplodeRadius,gMass);
PlaySound(thisObject,gEndSound);
MakeDecal(thisObject,1,0);
SetCollidableProperties(thisObject,0,0);
SetStyle(thisObject,4);
wakeupTime = time + 1.0;
return 0;
}
int Explosion(int param)
{
if (gPrivileged == 1)
{
FireSaveInfo(thisObject,hitValue,0,gMass,1);
ExplodeCommand(thisObject);
}
return 0;
}
int GetMaxAmmo(string dummy)
{
ReturnValue(thisObject, 1);
}
int addammo(string count)
{
int value = Str2Int(count);
gBulletCount = gBulletCount + value;
}
int AmmoCount(string dum)
{
ReturnValue(thisObject,gBulletCount);
}
int Draw(string ammoCount)
{
SetStyle(thisObject,2);
gBulletCount = Str2Int(ammoCount);
SetScale(thisObject,1.0);
}
int Pickup(string dummy)
{
ReturnValue(thisObject,gBulletCount);
gBulletCount = 0;
}
int Holster(string dummy)
{
ReturnValue(thisObject,gBulletCount);
gBulletCount = 0;
}
int Drop(string dummy)
{
int returnBullet;
SetCollidableProperties(thisObject,1,0);
SetStyle(thisObject,2);
PlaySound(thisObject,38);
ReturnValue(thisObject,0);
}
int Colliders(string dummy)
{
int result;
int value;
map::iterator ix;
map objInList;
result = 0;
if (state == 0)
{
objInList = Collisions(thisObject,0,1,0);
for (ix = begin(objInList) ;ix != end(objInList); ++ix)
{
value = AddObjectTo(first(dereference(ix)),thisObject);
if (value != 0)
{
PlaySound(thisObject,35);
SetScale(thisObject,1.0);
break;
}
}
}
else if (state == 2)
{
objInList = Collisions(thisObject,0,0,0);
for (ix = begin(objInList) ;ix != end(objInList); ++ix)
{
{
Explosion(0);
break;
}
}
}
return 0;
}
int Collidants(string dummy)
{
if (state == 2)
{
int result;
map::iterator ix;
map objInList;
result = 0;
int exploded;
exploded = 0;
objInList = Collisions(thisObject,1,0,0);
for (ix = begin(objInList) ;ix != end(objInList); ++ix)
{
{
Explosion(0);
exploded = 1;
break;
}
}
if (exploded == 0)
PlaySound(thisObject,18);
}
return 0;
}
int TimedEvent(int input)
{
real time;
time = GetTime(thisObject);
if (state == 2)
{
if (time > gEndTime)
{
wakeupTime = time;
state = 3;
}
else
{
if (gContrail == 1)
{
if (gSmokeTrail == 0)
{
gSmokeTrail = LaunchEFX(thisObject,1,0);
SetOldPos(thisObject);
}
else
{
MoveEFX(thisObject,gSmokeTrail,1);
SetOldPos(thisObject);
}
wakeupTime = time + gSmokeTime;
}
else
{
wakeupTime = gEndTime;
}
}
}
else if (state == 3)
{
Explosion(0);
}
else if (state == 4)
{
Remove(thisObject);
wakeupTime = -1.0;
}
else if (state == 5)
{
state = 2;
SetStyle(thisObject,0);
wakeupTime = time + 0.2;
}
else
wakeupTime = -1.0;
return 0;
}